﻿#region namespaces

using System.Text;

using SLIITPro.Data.Entity;

#endregion

namespace SLIITPro.Controls
{
    public partial class Comment : System.Web.UI.UserControl
    {

        private Comments _comments;
        public Comments Comments
        {
            get { return _comments; }
            set { _comments = value; }

        }

        protected string AdminLinks
        {
            get
            {
                if (Page.User.Identity.IsAuthenticated)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat("   <a class=\"email\" href=\"mailto:{0}\"><img src=\"{1}\" width=\"14\" height=\"10\" border=\"0\" />  {0}</a>", Comments.Email, Core.CoreSettings.RelativeWebRoot + "Images/mail.gif");
                    if (Page.User.IsInRole("administrator"))
                    {
                        const string confirmDelete = "Are you sure want to delete comment";
                        sb.AppendFormat(
                            " | <a href=\"javascript:void(0);\" onclick=\"if (confirm('{1}?')) location.href='?deletecomment={0}'\">{2}</a>",
                            Comments.Id, confirmDelete, "Delete");
                    }
                    return sb.ToString();
                }
                return string.Empty;
            }
        }
    }
}